package com.project.weimi.activity;

import com.project.weimi.R;
import com.project.weimi.dialog.CouponDialogAddSuccess;
import com.project.weimi.dialog.CouponDialogNoExist;
import com.project.weimi.utils.SetClickListener;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class CouponActivity extends BaseActivity {

	private TextView tv_add;
	// 无优惠券对话框
	private CouponDialogNoExist dialogNoExist;
	// 优惠券添加成功对话框
	private CouponDialogAddSuccess dialogAddSuccess;
	int count = 1;
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentViewWithBar(R.layout.activity_coupon, "我的优惠券");

		initView();
		
	}

	private void initView(){
		tv_add = (TextView)findViewById(R.id.tv_add);
		
		// 监听
		SetClickListener.setClickListener(listener, tv_add);
		
	}
	
	private OnClickListener listener = new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			if(count == 1){
				dialogNoExist = new CouponDialogNoExist(CouponActivity.this);
				dialogNoExist.show();
				count = 2;
			}else{
				dialogAddSuccess = new CouponDialogAddSuccess(CouponActivity.this);
				dialogAddSuccess.show();
				count = 1;
			}
			
		}
	};
	
	@Override
	void setStatusBar(int statusBarColorRes) {
		super.setStatusBar(R.color.transparent_3);
	}
	
	
}
